<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeckillProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('seckill_products', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('product_id')->index()->default(0)->comment('关联商品ID');
            $table->unsignedInteger('seckill_count')->default(0)->comment('秒杀商品数量');
            $table->unsignedInteger('seckill_count_all')->default(0)->comment('秒杀商品总数量');
            $table->boolean('is_new')->default(false)->comment('是否是新人商品');
            $table->boolean('is_open')->default(true)->comment('是否开启');
            $table->string('unallowed_area')->nullable()->comment('不发货地区');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('seckill_products');
    }
}
